<template>
  <div class="left-content">
    <img src="/img/dotnet.svg" alt="" />
    <p>· {{ props.processFormName }}</p>
  </div>

  <el-steps :active="active" finish-status="success" simple class="steps">
    <el-step title="基础信息" />
    <el-step title="表单设计" />
  </el-steps>
  <div class="right-btns">
    <el-button @click="prev" v-if="!data.isDisable">上一步</el-button>
    <el-button @click="next" v-if="data.isDisable">下一步</el-button>
    <el-button type="primary" @click="save">保存</el-button>
    <el-button @click="cancel">取消</el-button>
  </div>
</template>

<script lang="ts" setup>
import { ref, reactive, onMounted } from 'vue';
import mitt from '@/utils/bus';
const bus: any = mitt;
const data = reactive({
  isDisable: false,
  title: '',
});
const emit = defineEmits(['cancel']);
const cancel = () => {
  emit('cancel');
};
const save = () => {
  bus.emit('formSave', true);
};
const props = defineProps({
  processFormName: {},
});
const active = ref(1);
const isDisable = ref(false);
const prev = () => {
  //   if (active.value == 1) {
  data.isDisable = true;
  active.value = active.value - 1;

  if (active.value == 0) {
    data.title = '基础信息';
  } else {
    data.title = '表单设计';
  }
  bus.emit('active', active.value);
  //   }
};
const next = () => {
  data.isDisable = false;
  active.value = active.value + 1;
  if (active.value == 0) {
    data.title = '基础信息';
  } else {
    data.title = '表单设计';
  }
  bus.emit('active', active.value);
};
//formRightInfo
onMounted(() => {
  if (active.value == 0) {
    data.title = '基础信息';
  } else {
    data.title = '表单设计';
  }
});
</script>
<style lang="scss">
.left-content {
  display: flex;
  width: 210px;
  height: 60px;
  -webkit-box-align: center;
  align-items: center;
  img {
    width: auto;
    height: 60px;
    vertical-align: top;
    margin-right: 3px;
    font-size: 30px;
    color: #fff;
  }
  p {
    display: inline-block;
    margin: 0;
    color: #333;
    font-size: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
    cursor: pointer;
  }
}
.steps {
  width: 450px;
  justify-items: flex-start;
  flex-shrink: 0;
  display: flex;
  padding: 6px 99px !important;
  background-color: #ffffff !important;
}
.right-btns {
  // width: 410px;
  display: flex;
  text-align: right;
}
</style>
